build: Add post-install script
authorEmmanuele Bassi <ebassi@gnome.org>
Wed, 26 Apr 2017 14:59:43 +0000 (15:59 +0100)
committerEmmanuele Bassi <ebassi@gnome.org>
Wed, 3 May 2017 14:10:57 +0000 (15:10 +0100)
When building GTK+ straight from the repository without any assistance
from packaging tools, we need to trigger system-wide updates, like the
icon theme cache update, or the schema compilation.

build-aux/meson/post-install.sh [new file with mode: 0755]
meson.build

diff --git a/build-aux/meson/post-install.sh b/build-aux/meson/post-install.sh
new file mode 100755 (executable)
index 0000000..a59d7d5
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+gtk_version=$1
+gtk_abi_version=$2
+gtk_libdir=$3
+gtk_datadir=$4
+
+# Package managers set this so we don't need to run
+if [ -z "$DESTDIR" ]; then
+  echo Compiling GSettings schemas...
+  glib-compile-schemas ${gtk_datadir}/glib-2.0/schemas
+
+  echo Updating desktop database...
+  update-desktop-database -q ${gtk_datadir}/applications
+
+  echo Updating icon cache...
+  gtk-update-icon-cache -q -t -f ${gtk_datadir}/icons/hicolor
+
+  echo Updating input method modules cache...
+  gtk4-query-immodules > ${gtk_libdir}/gtk-${version}/${gtk_abi_version}/immodules.cache
+fi
index 4dcc641a195664580a2abfb3e614be2cd5ab16bd..58cbee1969475ea994224fa2b0a2c56a354f369f 100644 (file)
@@ -95,10 +95,13 @@ endif
 os_unix = not os_win32
 
 gtk_prefix = get_option('prefix')
+gtk_includedir = join_paths(gtk_prefix, get_option('includedir'))
 gtk_libdir = join_paths(gtk_prefix, get_option('libdir'))
 gtk_datadir = join_paths(gtk_prefix, get_option('datadir'))
 gtk_localedir = join_paths(gtk_prefix, get_option('localedir'))
 gtk_sysconfdir = join_paths(gtk_prefix, get_option('sysconfdir'))
+gtk_applicationsdir = join_paths(gtk_datadir, 'applications')
+gtk_schemasdir = join_paths(gtk_datadir, 'glib-2.0/schemas')
 
 cc = meson.get_compiler('c')
 
@@ -584,3 +587,10 @@ if get_option('enable-documentation')
   subdir('docs/tools')
   subdir('docs/reference')
 endif
+
+# Keep this in sync with post-install.sh expected arguments
+meson.add_install_script('build-aux/meson/post-install.sh',
+                         gtk_version,
+                         gtk_binary_version,
+                         gtk_libdir,
+                         gtk_datadir)